package com.example.zlw.singpixdemo;

import android.content.Context;
import android.content.Intent;

/**
 * Created by ZLW on 2017/7/2.
 */

public class ScreenManager {

    private static final String BROAD_FINISH_ACTIVITY = "com.erpo.zlw";
    private Context mContext;

    private static ScreenManager instance;

    public ScreenManager(Context context) {
        this.mContext = context;
    }

    public static ScreenManager getInstance(Context context) {
        if (instance == null) {
            synchronized (ScreenManager.class) {
                if (instance == null) {
                    instance = new ScreenManager(context);
                }
            }
        }

        return instance;
    }

    public void startActivity() {
        Intent intent = new Intent(mContext,LiveActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivity(intent);
    }

    public void finishActivity(){
        Intent intent = new Intent(BROAD_FINISH_ACTIVITY);
        
        mContext.sendBroadcast(intent);
    }
}
